#
#   Settings.py
#
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; version 2 of the License.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   Copyright
#   Author: Salvatore S. Gionfriddo
#   Contributors:
#   Created: 2007.11.04
#   Last Modified: 2007.11.07
#

from Kid import BasicKid, FatKid, FastKid, StrongKid, WeakKid, ThrowingKid, SantaKid, ElfKid, DevilKid
from Fink import Fink
from MegaKid import MegaKid, RingKid
from EvilGreg import EvilGreg, DeadEvilGreg
from Google import Google, DeadGoogle
from Animation import Animation
from PowerUp import PowerUp

# Actions
ACTIONS = {"Kills": "Kill",
           "Eaten": "Eat",
           "Pickup": "Pick Up",
           "Use": "Use"}

# Sub-actions
SUBACTIONS = ["Punch", "Kick", "Flame", "Gas"]

# Enemies
ENEMIES = {"BasicKid": ["Kid", BasicKid],
           "FastKid": ["Fast Kid", FastKid],
           "StrongKid": ["Strong Kid", StrongKid],
           "FatKid": ["Fat Kid", FatKid],
           "WeakKid": ["Weak Kid", WeakKid],
           "ThrowingKid": ["Throwing Kid", ThrowingKid],
           "SantaKid": ["Santa Kid", SantaKid],
           "ElfKid": ["Elf Kid", ElfKid],
           "DevilKid": ["Devil Kid", DevilKid],
           "Fink": ["Fink", Fink],
           "MegaKid": ["Megakid", MegaKid],
           "RingKid": ["Ringer", RingKid]}

# Powerups
POWERUPS = ["Drugs", "Pizza", "Indian", "Tacos", "Candy", "Pumpkin",
            "Dead_BasicKid", "Dead_FastKid", "Dead_StrongKid", "Dead_FatKid", "Dead_WeakKid",
            "Dead_ThrowingKid", "Dead_SantaKid", "Dead_ElfKid", "Dead_DevilKid",
            "Dead_Fink", "Dead_MegaKid", "Dead_RingKid"]

# Other
OTHER = ["TIME", "ENEMY", "POWERUP", "BOSS"]

# Heros
HEROS = {"EvilGreg": ["Evil Greg", EvilGreg, DeadEvilGreg], "Google": ["Google", Google, DeadGoogle]}

# Missions

# GENERATORS
def getGoals():
    GOAL_DESCRIPTIONS = {}
    for action in ACTIONS:
        GOAL_DESCRIPTIONS.update({action: action})
        for subaction in SUBACTIONS:
            GOAL_DESCRIPTIONS.update({action + 'By' + subaction: action + ' by ' + subaction})
            for enemy in ENEMIES:
                GOAL_DESCRIPTIONS.update({enemy + action + 'By' + subaction: ENEMIES[enemy][0] + 's by ' + subaction})
                GOAL_DESCRIPTIONS.update({enemy + action: ENEMIES[enemy][0] + 's to ' + ACTIONS[action]})
    GOAL_DESCRIPTIONS.update({"Time": "Time Remaining"})
    return GOAL_DESCRIPTIONS

def getStatTrackers(gameObjectManager, statistics, level):
    STAT_TRACKERS = {}
    for action in ACTIONS:
        STAT_TRACKERS.update({action: gameObjectManager.egStats.viewByLevelFunction([statistics.__dict__[action.upper()]], level)})
        STAT_TRACKERS.update({'Total'+action: gameObjectManager.egStats.viewFunction([statistics.__dict__[action.upper()]])})
        for subaction in SUBACTIONS:
            STAT_TRACKERS.update({action + 'By' + subaction: gameObjectManager.egStats.viewByLevelFunction([statistics.__dict__[subaction.upper()]], level)})
            for enemy in ENEMIES:
                STAT_TRACKERS.update({enemy + action + 'By' + subaction: gameObjectManager.egStats.viewByLevelFunction([statistics.__dict__[action.upper()], statistics.__dict__[subaction.upper()], statistics.__dict__[enemy.upper()]], level)})
                STAT_TRACKERS.update({enemy + action: gameObjectManager.egStats.viewByLevelFunction([statistics.__dict__[action.upper()], statistics.__dict__[enemy.upper()]], level)})
                STAT_TRACKERS.update({'Total'+enemy + action: gameObjectManager.egStats.viewFunction([statistics.__dict__[action.upper()], statistics.__dict__[enemy.upper()]])})
    STAT_TRACKERS.update({"Time": gameObjectManager.egStats.viewByLevelFunction([statistics.__dict__["time".upper()]], level)})
    STAT_TRACKERS.update({"TotalTime": gameObjectManager.egStats.viewFunction([statistics.__dict__["time".upper()]])})
    return STAT_TRACKERS
    
#Dynamic Class Modification
INDIAN_FRAME_TICKS = 15
PUMPKIN_FRAME_TICKS = 10
ANIMATION_TABLE = []
for i in range(len(POWERUPS)):
    setattr(PowerUp, POWERUPS[i].upper(), i)
    frames = 1
    if POWERUPS[i].upper() == "INDIAN": frames = INDIAN_FRAME_TICKS
    elif POWERUPS[i].upper() == "PUMPKIN": frames = PUMPKIN_FRAME_TICKS
    ANIMATION_TABLE.append((i, POWERUPS[i], frames, Animation.NO_KEY_FRAME))

setattr(PowerUp, 'NUM_ANIMATIONS', len(POWERUPS))
setattr(PowerUp, 'LEFT', len(POWERUPS))

setattr(PowerUp, 'ANIMATION_TABLE', ANIMATION_TABLE)
setattr(PowerUp, 'DEFAULT_ANIMATION', 0)
